#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

//https://www.luogu.com.cn/problem/P5736
using namespace std;
const int N = 110;
int n = 0;
int a[N];
bool isprime(int x)
{
	if (x <= 1)return false;

	for (int i = 2; i <= x / i; ++i)
	{
		if (x % i == 0)return false;
	}
	return true;
}


int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		cin >> a[i];
		if (isprime(a[i]))
			cout << a[i] << ' ';
	}

	return 0;
}